package cn.itcast.order.service.impl;

import cn.itcast.order.entity.Order;
import cn.itcast.order.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Component
public class TransactionalTestClient {
    @Autowired
    private OrderMapper orderMapper;

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public void testNotSupported(){
        Order order = new Order();
        order.setUserId("subUser");
        order.setCommodityCode("被调用的方法的商品");
        order.setCount(2);
        order.setMoney(2);
        orderMapper.insert(order);
        throw new RuntimeException("手动抛出运行时异常");
    }

}
